package com.jiang.mybatis_plus.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.jiang.mybatis_plus.common.enums.GenderEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = true)
@TableName(value = "user", autoResultMap = true)
@ApiModel(value="User对象", description="用户表")
public class User extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "名称")
    private String name;

    @ApiModelProperty(value = "密码")
    private String password;

    @ApiModelProperty(value = "性别", notes = "com.jiang.mybatis_plus.common.enums.GenderEnum")
    private GenderEnum gender;

    @TableField(typeHandler = JacksonTypeHandler.class)
    @ApiModelProperty(value = "标签[xxx,xxx]")
    private List<String> label;

    @TableField(value = "other_info",typeHandler = JacksonTypeHandler.class)
    @ApiModelProperty(value = "其他信息")
    private OtherInfo otherInfo;

    @Data
    public static class OtherInfo implements Serializable {

        private static final long serialVersionUID = 1L;

        @ApiModelProperty(value = "名称")
        private String name;

        @ApiModelProperty(value = "标签[xxx,xxx]")
        private List<String> label;
    }
}
